package com.form;

import java.sql.Date;
import java.util.Calendar;

/**
 * 空房查询模型类
 * 
 * @author 0912652
 */

public class QueryForm {

	private int id;
	private Date begin;
	private Date end;

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Date getBegin() {
		return begin;
	}

	public void setBegin(Date begin) {
		this.begin = begin;
	}

	public Date getEnd() {
		return end;
	}

	public void setEnd(Date end) {
		this.end = end;
	}

	@Override
	public boolean equals(Object obj) {
		Calendar c1 = Calendar.getInstance();
		Calendar c2 = Calendar.getInstance();
		c1.setTime(begin);
		c2.setTime(end);
		QueryForm form = (QueryForm) obj;
		Calendar objBegin = Calendar.getInstance();
		Calendar objEnd = Calendar.getInstance();
		objBegin.setTime(form.getBegin());
		objEnd.setTime(form.getEnd());
		if (form.getId() == id && c1.compareTo(objBegin) == 0
				&& c2.compareTo(objEnd) == 0) {
			return true;
		} else {
			return false;
		}
	}

}
